var numbers = [1,2,4,3,5];
numbers.forEach(function(item,index,arry){
    console.log(item,index,arry[index]);
});

var data = [1,2,3,4];
data.forEach(function(v,i,a){
    a[i] = v+1;
});
console.log("data==",data);


var sum = 0;
data.forEach(function(value){
    sum+=value;
});
console.log("sum==",sum);


var everyResult = numbers.every(function(item,index,arr){
    return (item>2);
});

console.log(everyResult);

var someResult = numbers.some(function(item,index,arr){
    return (item>2);
});
console.log(someResult);

var filterResult = numbers.filter(function(item,inde,arr){
    return item>2;
});
console.log(filterResult);

var mapResult = numbers.map(function(item,index,arr){
    return item*item;
})
console.log(mapResult);

var reduceResult = numbers.reduce(function(pre,cur,index,arr){
    return pre+cur;
});
console.log(reduceResult);

var maxResult = numbers.reduce(function(pre,cur,index,arr){
    return pre > cur ? pre:cur;
});
console.log(maxResult);

